package com.sdx.console.content.service;

import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.content.dao.ResContentChapterDao;
import com.sdx.console.content.entity.ResContentChapter;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 章节管理 Service
 */

@Service
@Transactional
public class ResContentChapterService extends BaseService<ResContentChapter>{

    @Resource
	private ResContentChapterDao resContentChapterDao;

    public PageQuery<ResContentChapter>queryByCondition(PageQuery query){
        PageQuery ret =  resContentChapterDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelResContentChapter(List<String> ids){
        try {
            resContentChapterDao.batchDelResContentChapterByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除章节管理失败", e);
        }
    }

    public int selectMaxChapterNo(int contentId) {
    	return resContentChapterDao.selectMaxChapterNo(contentId);
    }
}